<template>
	<view>
		<star-nav :type="4" :listType="2" title="星际机场" icon="/static/icon-images/air.png"></star-nav>
		<view class="content">

			<airports ref="planeRef"></airports>
			<!-- <button @click="android.showInterstitialAd()" >插屏</button> -->
			<!-- <button @click="android.showRewardAd(1,2)"  @click="handeUser2">激励视频</button> -->
		</view>
	</view>
</template>

<script>
	import {userAdvertising} from '@/api/index.js'
	import Vue from 'vue'
	import airports from './components/airports/index.vue'
	export default {
		components: {
			airports
		},
		data() {
			return {
				isItAdFree:false
			}
		},
		onShow() {
			this.getUserAdvertising()
			setTimeout(()=>{
				this.$refs.planeRef.getList()
			},500)
		},
		onLoad() {
			setTimeout(()=>{
				// 插屏广告好
				if(!this.isItAdFree){
					window.android.showInterstitialAd()
				}
			},500)
		},
		methods: {
			// 是否免广告
			async getUserAdvertising(){
				let res = await userAdvertising()
				this.isItAdFree = res.data
			},
			// 激励视频成功
			motivateVideosToSucceed() {
				console.log('激励视频成功');
			},
			// 激励视频失败
			incentiveVideoFailed() {
				console.log('激励视频失败');
			}
		}
	}
</script>

<style lang="scss">
	page {
		width: 100%;
		height: 100vh;
		background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
	}

	.content {
		padding: 20rpx;
	}

	.mt-20 {
		margin-top: 20rpx;
	}
</style>